package Examin.WangYi;

import java.util.Arrays;
import java.util.Scanner;

public class fourth {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long[] nums = new long[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextLong();
        }

        long[][] zeros = new long[n][n];

        //初始化
        int res = 0;
        for (int i = 0; i < n; i++) {
            zeros[i][i] = nums[i];

        }
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                if(j>i){
                    zeros[i][j] = zeros[i][j-1] * nums[j];
                }

                res += getZeros(zeros[i][j]);
            }
        }
        System.out.println(res);

    }

    private static int getZeros(long num){
        int res = 0;
        while(num>0){
            //当前末尾0
            if(num%10!=0){
                break;
            }
            //末尾有0
            res++;
            num = num/10;
        }
        return res;
    }
}
